home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Sample Code / Sprocket / Interfaces / Sprocket.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-06  |  4.7 KB  |  191 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        Sprocket.h
  3.  
  4.     Contains:    Prototypes for the “guts” of a Macintosh application.
  5.  
  6.     Written by: Dave Falkenburg
  7.  
  8.     Copyright:    © 1993-1994 by Dave Falkenburg, all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.      
  12.          <8>     12/6/94    DRF        Add  “sprocket credits” box resource ID.
  13.          <7>    11/23/94    DRF        Add ToggleCheckBox, a nice little dialog item utility.
  14.          <6>    11/12/94    DRF        AppConditionals.h is now BuildConditionals.h.  Also revised some
  15.                                     QuickDrawGX stuff.
  16.          <5>     11/8/94    DRF        Add prototype for DragDestinationIsTheTrash.
  17.          <4>     9/27/94    DRF        Changed filename to Sprocket.h. Also made scrap coercion
  18.                                      routines more explicit.
  19.          <3>      9/9/94    DRF        Reordered headers and removed redundant #includes.
  20.          <2>      9/4/94    DRF        Added scroll bar constants.
  21.  */
  22.  
  23. #ifndef        _SPROCKET_
  24. #define        _SPROCKET_
  25.  
  26. #ifndef        _BUILDCONDITIONALS_
  27. #include    "BuildConditionals.h"
  28. #endif
  29.  
  30. #ifndef        __TYPES__
  31. #include    <Types.h>
  32. #endif
  33.  
  34. #ifndef        __WINDOWS__
  35. #include    <Windows.h>
  36. #endif
  37.  
  38. #ifndef        __DIALOGS__
  39. #include    <Dialogs.h>
  40. #endif
  41.  
  42. #ifndef        __STANDARDFILE__
  43. #include    <StandardFile.h>    //    for ModalFilterYDUPP
  44. #endif
  45.  
  46. #ifndef        __DRAG__
  47. #include    <Drag.h>
  48. #endif
  49.  
  50. #include    "Preferences.h"
  51. #include    "Window.h"
  52.  
  53. #if    qUseQuickDrawGX
  54. #include    <FixMath.h>            //    make sure we don’t use GX lame #define of “fixed1”
  55. #include    <graphics types.h>
  56. #endif
  57.  
  58. //    useful macros
  59.  
  60. #if    qDebug
  61. #define    DebugMessage(x)    DebugStr(x)
  62. #else
  63. #define    DebugMessage(x)
  64. #endif
  65.  
  66. //    Resource IDs
  67.  
  68. #define    kErrorAlertID                        128
  69. #define    kStandardCloseAlertID                129
  70. #define    kStandardCloseWithNewPubsAlertID    130
  71.  
  72. #define    kCoreErrorStrings                    128
  73. #define    kUnsupportedSystemSoftware            1
  74. #define    kNeedsThreadManager                    2
  75. #define    kNeedsQuickdrawGX                    3
  76.  
  77. #define    kStandardCloseStrings                129
  78. #define    kQuittingStr                        1
  79. #define    kClosingStr                            2
  80.  
  81. #define    kPreferencesFileStrings                130
  82. #define    kPreferencesFileName                1
  83.  
  84. #define    kSplashPictureID                    128
  85.  
  86. #define    kCreditsBox                            258
  87.  
  88. #if        qUseQuickDrawGX
  89. #define    kUseGraphicsSizeResource        0
  90. #define    kAllowGXToExtendGraphicsHeap    ((gxClientAttribute) 0)
  91. #endif
  92.  
  93. //    Useful constants
  94.  
  95. enum
  96.     {
  97.     kScrollbarWidth = 16,    //    width of a standard Macintosh scrollbar
  98.     kScrollbarTweak = 2        //    left edge = rightedge - kScrollbarWidth + kScrollbarTweak
  99.     };
  100.  
  101. //    Useful functions provided by App:
  102.  
  103. void                    HandleEvent(EventRecord *anEvent);
  104. void                    HandleClose(WindowPtr aWindow);
  105.  
  106. short                    StandardAlert(    short alertID,
  107.                                         short defaultItem                = ok,
  108.                                         short cancelItem                = 0,
  109.                                         ModalFilterUPP customFilterProc    = nil);
  110.  
  111. void                    ErrorAlert(short stringList,short whichString);
  112. void                    FatalErrorAlert(short stringList,short whichString);
  113.  
  114. extern ModalFilterUPP    StandardDialogFilter;
  115. extern ModalFilterYDUPP    StandardDialogFilterYD;
  116. extern void                PseudoClickInDialogItem(DialogPtr theDialog, short itemToClick);
  117. extern Boolean            ToggleCheckBox(DialogPtr theDialog, short theCheckBox);
  118.  
  119. enum    StandardCloseResult
  120.     {
  121.     kSaveDocument = 1,
  122.     kCancelSaveDocument = 2,
  123.     kDontSaveDocument = 3
  124.     };
  125.  
  126. StandardCloseResult        StandardCloseDocument(const StringPtr documentType,StringPtr documentName, Boolean hasNewEditions, Boolean quitting);
  127.  
  128. OSErr                    CheckAppleEventForMissingParams(AppleEvent *theAppleEvent);
  129.  
  130. short                    OpenPreferencesResFile(void);
  131.  
  132. Boolean                    DragDestinationIsTheTrash(DragReference theDrag);
  133.  
  134.  
  135. //    AOCE “FrontWindow”-equivalent routine for the Standard Mail package
  136. extern FrontWindowUPP    FrontWindowProcForAOCEUPP;
  137.  
  138. //    Globals
  139.  
  140. extern    Boolean                gDone;
  141. extern    Boolean                gMenuBarNeedsUpdate;
  142.  
  143. extern    Boolean                gHasColorQuickdraw;
  144. extern    Boolean                gHasThreadManager;
  145. extern    Boolean                gHasDragManager;
  146. extern    Boolean                gHasAOCE;
  147. extern    Boolean                gHasDisplayManager;
  148.  
  149. #if    qInlineInputAware
  150. extern    Boolean                gHasTextServices;
  151. extern    Boolean                gHasTSMTE;
  152. #endif
  153.  
  154. #if    qUseQuickDrawGX
  155. extern    Boolean                gHasQuickDrawGX;
  156. extern    long                gQuickDrawGXVersion;
  157. extern    long                gQuickDrawGXPrintingVersion;
  158. extern    gxGraphicsClient    gQuickDrawGXClient;
  159. #endif
  160.  
  161. extern    GrafPtr                gWindowManagerPort;
  162. extern    Rect                gDeskRectangle;
  163. extern    RgnHandle            gMouseRegion;
  164.  
  165. extern    short                gPreferencesRsrcRefNum;
  166.  
  167.  
  168. /////////////////////////////////////////////////////////////////
  169. //
  170. //    Routines that the application MUST supply:
  171.  
  172.  
  173. //        intialization & tear down
  174. extern    OSErr    SetupApplication(void);
  175. extern    void    TearDownApplication(void);
  176.  
  177. //        menu handling:
  178. extern    void    HandleMenu(TWindow * topWindowObj,long menuCode);
  179.  
  180. //        scrap coercion hooks:
  181. extern    void    WriteLocalClipboardToScrap(void);
  182. extern    void    ReadLocalClipboardFromScrap(void);
  183.  
  184. //        document handling routines:
  185. extern    OSErr    CreateNewDocument(void);
  186. extern    OSErr    OpenDocument(LetterDescriptor *,void *);
  187. extern    OSErr    PrintDocument(LetterDescriptor *,void *);
  188. extern    Boolean    QuitApplication(void);
  189.  
  190. #endif
  191.